<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增题目信息')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-quesInfo-add">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">题目类型：</label>
            <div class="col-sm-8">
                <select name="learnType" th:with="type=${@dict.getType('learn_type')}" class="form-control m-b"
                        required>
                    <option value="">所有</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">答题类型：</label>
            <div class="col-sm-8">
                <select name="answerType" id="answerType" th:with="type=${@dict.getType('answer_type')}" class="form-control m-b"
                        required onchange="updateAnsSelect()">
                    <option value="">所有</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">问题描述：</label>
            <div class="col-sm-8">
                <input name="quesDesc" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">答案解析：</label>
            <div class="col-sm-8">
                <input name="ansAnalysis" class="form-control" type="text" required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">选项A：</label>
            <div class="col-sm-8">
                <input name="quesA" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">选项B：</label>
            <div class="col-sm-8">
                <input name="quesB" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">选项C：</label>
            <div class="col-sm-8">
                <input name="quesC" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">选项D：</label>
            <div class="col-sm-8">
                <input name="quesD" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">选项E：</label>
            <div class="col-sm-8">
                <input name="quesE" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">选项F：</label>
            <div class="col-sm-8">
                <input name="quesF" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">标准答案：</label>
            <div class="col-sm-8">
                <select class="form-control select2-multiple" multiple name="ansStandard" required id="ansStandard" >
                    <option value="">请选择正确答案项</option>
                    <option value="A">A</option>
                    <option value="B">B</option>
                    <option value="C">C</option>
                    <option value="D">D</option>
                    <option value="E">E</option>
                    <option value="F">F</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">分数：</label>
            <div class="col-sm-8">
                <input name="quesPoints" class="form-control" type="number">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
    var prefix = ctx + "web/quesInfo"
    $("#form-quesInfo-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-quesInfo-add').serialize());
        }
    }

    function updateAnsSelect() {
       var selType= $("#answerType").val()
    }
</script>
</body>
</html>